package com.example.forestapp

import android.content.Intent
import android.os.Bundle
import android.widget.ImageButton
import android.widget.SearchView
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView

class HistoryDataActivity : AppCompatActivity() {
    private lateinit var searchView: SearchView
    private lateinit var recyclerView: RecyclerView
    private lateinit var btnBack: ImageButton

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_history_data)

        searchView = findViewById(R.id.search_view)
        recyclerView = findViewById(R.id.recycler_view)
        btnBack = findViewById(R.id.btn_back)

        setupViews()
    }

    private fun setupViews() {
        btnBack.setOnClickListener {
            finish()
        }

        recyclerView.layoutManager = LinearLayoutManager(this)
        // TODO: 设置适配器并加载数据

        searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
            override fun onQueryTextSubmit(query: String?): Boolean {
                // TODO: 执行搜索请求
                return true
            }

            override fun onQueryTextChange(newText: String?): Boolean {
                return false
            }
        })
    }

    private fun onForestItemClick(forestId: String) {
        val intent = Intent(this, ForestDetailActivity::class.java)
        intent.putExtra("forest_id", forestId)
        startActivity(intent)
    }
} 